package com.gc.server.vo.down;


import lombok.Data;

import java.util.Date;

import com.alibaba.excel.annotation.*;

import java.io.Serializable;


import java.math.BigDecimal;

import com.gc.server.entity.CostApplyEntity;
import com.gc.server.vo.CostApplyVo;

import com.gc.server.enums.CostApplyTypeEnum;
import com.gc.server.enums.CostApplyStatusEnum;

/**
 * 费用申请实体
 * 表名 cost_apply
 *
 * @author hxf
 * @email 505860922@qq.com
 * @date Wed Oct 21 17:34:54 CST 2020
 */
@Data
public class CostApplyDown implements Serializable {
    @ExcelIgnore
    private static final long serialVersionUID = 1L;

    //
    @ExcelProperty("")
    private Long id;

    //用户ID
    @ExcelProperty("用户ID")
    private Long userId;

    @ExcelProperty("用户名")
    private String name;

    @ExcelProperty("使用单位")
    private String unit;



    //金额
    @ExcelProperty("交通费用")
    private BigDecimal carMoney;

    @ExcelProperty("住宿费用")
    private BigDecimal houseMoney;


    @ExcelProperty("补贴费用")
    private BigDecimal moreMoney;

    @ExcelProperty("其他费用")
    private BigDecimal otherMoney;

    @ExcelProperty("支付方式")
    private String payWay;

    @ExcelProperty("支付时间")
    private Date payTime;

    //金额
    @ExcelProperty("金额")
    private BigDecimal amount;

    //理由
    @ExcelProperty("备注")
    private String remark;

    //理由
    @ExcelProperty("缘由")
    private String info;

    //卡号信息
    @ExcelProperty("卡号信息")
    private String bankInfo;

    //申请时间
    @ExcelProperty("申请时间")
    private Date time;

    //IMG-图片
    @ExcelProperty("IMG-图片")
    private String img;

    //ENUM-类型:"APPLY-申请","COST-报销"
    @ExcelIgnore
    private Integer type;
    @ExcelProperty("类型")
    private String typeStr;

    //ENUM-状态:"WAIT-待审核","PASS-通过","REFUSE-拒绝"
    @ExcelIgnore
    private Integer status;
    @ExcelProperty("状态")
    private String statusStr;


    public CostApplyDown() {

    }

    public CostApplyDown(CostApplyVo vo) {
        CostApplyEntity entity = vo.getEntity();
        this.setId(entity.getId());
        this.setName(vo.getUser().getName());
        this.setUserId(entity.getUserId());

        this.setAmount(entity.getAmount());

        this.setRemark(entity.getRemark());
        this.setInfo(entity.getInfo());
        this.setPayTime(entity.getPayTime());
        this.setHouseMoney(entity.getHouseMoney());
        this.setCarMoney(entity.getCarMoney());
        this.setMoreMoney(entity.getMoreMoney());
        this.setOtherMoney(entity.getOtherMoney());
        this.setBankInfo(entity.getBankInfo());
        this.setPayWay(entity.getPayWay());
        this.setTime(entity.getTime());

        this.setImg(entity.getImg());

        this.setUnit(entity.getUnit());

//        this.setType(entity.getType());
//        if (entity.getType() != null) {
//            this.setTypeStr(CostApplyTypeEnum.indexOf(entity.getType()));
//        }

        this.setTypeStr(entity.getTitle());

        this.setStatus(entity.getStatus());
        if (entity.getStatus() != null) {
            this.setStatusStr(CostApplyStatusEnum.indexOf(entity.getStatus()));
        }

    }


}
